<?php

namespace App\Http\Controllers\Rent\Product;

use App\Http\Controllers\ShopController;
use App\Models\Product\Product as ProductModel;

class ProductController extends ShopController
{
    public function index()
    {
        $page = request('page',1);
        $limit = request('limit',10);

        $start = ($page - 1) * $limit;

        $count = ProductModel::where('rentstatus','<>','1')->where('status','1')->count();

        $list = ProductModel::where('rentstatus','<>','1')->where('status','1')->OrderBy('createtime','desc')->offset($start)->limit($limit)->get();

        $data = [
            'count' => $count,
            'list' => $list
        ];

        if(count($list) > 0)
        {
            return $this->success('查询成功',$data);
        }else{
            return $this->error('暂无数据',[]);
        }
    }
}
